package com.uchiyou.walletwrapper.controller;

import com.uchiyou.walletwrapper.util.TxActionUtil;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(path = "/transaction")
public class TransactionController {

    @PostMapping(path = "/send")
    public String send(@RequestParam("address") String address,double amount){
        return TxActionUtil.sendtoaddress(address,amount);
    }
    @GetMapping(path = "/txid/{txid}")
    public String getById(@PathVariable String txid){
        return TxActionUtil.gettransaction(txid);
    }

    @GetMapping(path = "/list/recently")
    public String getTransactions(){
        return TxActionUtil.listtransactions();
    }
}
